from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop017_添加属性组"
firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")
# 添加属性组
name="好好学习"
firefox.find_element_by_xpath('//a[contains(.,"添加属性组")]').click()
firefox.find_element_by_id("attribute_group_name").send_keys(name)
# 清空输入框
firefox.find_element_by_id("attribute_group_sort").clear()
firefox.find_element_by_id("attribute_group_sort").send_keys("1")
# 保存
firefox.find_element_by_xpath('//button[contains(.,"保存属性组信息")]').click()

try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%name).is_displayed()
    writeLog("%s 测试通过" % testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试失败" % testCase)
firefox.quit()

